﻿@model KRM.Core.spKRWProductFeatures_Result
@{
    List<int> lstFeatureSection = ViewBag.FeatureSection;
    List<KRM.Core.Sections> lstSections = ViewBag.Section;
}
<form method="POST" id="fr-editfeature">
    <div class="span5">
        <div class="row-fluid">
            <div class="fieldset">
                <div class="legend"><span>Edit Feature</span></div>
                <input type="hidden" name="featureid" id="featureid" value="@Model.FeatureID"/>
                <div class="row-fluid">
                    <div class="span4">Feature Name</div>
                    <div class="span8">
                        <input name="featurename" type="text" class="input-block-level" value="@Model.FeatureName"/></div>
                </div>
                <div class="row-fluid">
                    <div class="span4">Feature Type</div>
                    <div class="span8">
                        @Html.DropDownList("TypeID", null, new { @class = "input-block-level", @disabled = "disabled"})
                    </div>
                </div>
                <div class="row-fluid">
                    <div class="span4">Feature Group</div>
                    <div class="span8">
                        @Html.DropDownList("GroupID", null, new { @class = "input-block-level"})
                    </div>
                </div>
                <div class="row-fluid">
                    <div class="span6">
                        <label>
                            <input type="checkbox" name="issitespecific" class="checkbox" @(Model.IsSiteSpecific ? "checked" : "")/>
                            Is Site Specific               
                        </label>
                    </div>
                    <div class="span6">
                        <label>
                            <input type="checkbox" name="required" class="checkbox" @(Model.Required ? "checked" : "")/>
                            Required
                        </label>
                    </div>
                </div>
                <div class="row-fluid">
                    <label>
                        <input type="checkbox" class="checkbox" name="globalfeature" @(Model.GlobalFeature ? "checked" : "")/>
                        All products have this feature
                    </label>
                </div>
            </div>
        </div>
        <div class="row-fluid">
            <div class="fieldset">
                <div class="legend"><span>Shopping Portals (Feature as Attribute)</span></div>
                <div class="row-fluid">
                    <div class="span4">Name of Attribute</div>
                    <div class="span8">
                        <input type="text" name="nameattribute" class="input-block-level" value="@Model.PortalAttributeName"/>
                    </div>
                </div>
                <div class="row-fluid">
                    <label>
                        <input type="checkbox" name="portalenabled" class="checkbox"@(Model.PortalEnabled != null && Model.PortalEnabled.ToString().ToLower() == "true" ? "checked" : "") />
                        Portal Enabled
                    </label>
                </div>
            </div>
        </div>
    </div>
    <div class="span7">
        <div class="fieldset">
            <div class="legend"><span>Feature Section (Website Template)</span></div>
            <div class="row-fluid" id="feature-section" style="max-height: 258px; overflow: auto; margin-bottom: 10px;">
                @foreach (var item in lstSections)
                {
                    <label>
                        <input type="checkbox" class="checkbox" value="@item.SectionID" @(lstFeatureSection.Contains(item.SectionID) ? "checked" : "")/>
                        @item.SectionName
                    </label>
                }
            </div>
            @{
                        string value = lstFeatureSection.Aggregate("", (current, item) => current + (item + ","));
                    }
            <input type="hidden" name="featuresection" id="featuresection" value="@value" />
            <div class="row-fluid text-right">
                <input type="button" class="btn btn-success w90" value="Edit Sections" onclick="PopupCenter('/products/EditFeatureSections', 800, 500)"/>
                <input type="submit" class="btn btn-primary w90" value="Save" />
            </div>
        </div>
    </div>
</form>
